#ifndef MODELS_H
#define MODELS_H

#include <QDate>
#include <QDateTime>

class User
{
public:
    int id;
    QString username;
    QString password;
    QString email;
    QString phone;
    int age;
    char gender; // Assuming 'M' for Male, 'F' for Female, etc.
    QString idNumber;
    int userLevel;

    User(int id,
         const QString &username,
         const QString &password,
         const QString &email,
         const QString &phone,
         int age,
         char gender,
         const QString &idNumber,
         int userLevel);
};

class Flight
{
public:
    int id;
    QString flightNumber;
    QString departure;
    QString destination;
    QString departureAirport;   // 新增字段
    QString destinationAirport; // 新增字段
    QDateTime departureTime;
    QDateTime arrivalTime;
    int firstClassSeats;
    int economyClassSeats;
    double firstClassPrice;
    double economyClassPrice;
    QString airlineCompany;
    QString aircraftModel;

    Flight(int id,
           const QString &flightNumber,
           const QString &departure,
           const QString &destination,
           const QString &departureAirport,
           const QString &destinationAirport, // 新增参数
           const QDateTime &departureTime,
           const QDateTime &arrivalTime,
           int firstClassSeats,
           int economyClassSeats,
           double firstClassPrice,
           double economyClassPrice,
           const QString &airlineCompany,
           const QString &aircraftModel);

    static QList<Flight> flightsList; // 声明全局的航班列表
    static QList<Flight> flightsList_return;
};

class SelectedDate
{
public:
    QDate departdate;
    QDate apartdate;

    SelectedDate()
        : departdate(QDate::currentDate())
        , apartdate(QDate::currentDate()) {};
    //SelectedDate(QDate de):departdate(de){};
    //SelectedDate(QDate de,QDate ap):departdate(de),apartdate(ap){};
};
extern SelectedDate selectedDate;

extern bool one_way; // 声明全局变量
extern bool adult; // 声明全局变量
extern bool eco_class; // 声明全局变量

class Order
{
public:
    int id;
    int userId;
    int flightId;
    QString seatType;
    int price;
    QString orderStatus;
    QDateTime paymentTime;
    QDateTime refundTime;
    QDateTime createdAt;

    Order(int id,
          int userId,
          int flightId,
          const QString &seatType,
          int price,
          const QString &orderStatus,
          const QDateTime &paymentTime,
          const QDateTime &refundTime,
          const QDateTime &createdAt);
};

#endif // MODELS_H
